<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"  
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">
    
    <h:head>
        <title>Phân quyền cho nhóm người dùng</title>
        <style type="text/css">
                .ui-widget {
                    font-family: Tahoma;
                    font-size: 11px;
                }
        </style>
    </h:head>  
    <h:body>
        <h:outputStylesheet library="css" name="component.css"/>
        <f:metadata>
            <f:viewParam name="groupId" value="#{groupBean.groupId}" />
            <f:event type="preRenderView" listener="#{groupBean.preRenderGrantView()}" />
        </f:metadata>
        <h:form id="mainForm">
            <p:outputPanel rendered="#{groupBean.group != null}" style="height: 100%;">
                <p:messages id="msgs"/>
                <p:toolbar style="margin-bottom: 10px; margin-top: 10px;">
                    <p:toolbarGroup align="left">  
                        <p:commandButton value="Cập nhật" actionListener="#{groupBean.grantAction()}" update=":mainForm"/>
                        <p:commandButton type="reset" value="Nhập lại"/>
                    </p:toolbarGroup>
                </p:toolbar>
                
                <p:tree value="#{groupBean.root}" var="node" selectionMode="checkbox"
                        selection="#{groupBean.selectedNodes}">  
                    <p:treeNode>  
                        <h:outputText value="#{node}" />  
                    </p:treeNode>  
                </p:tree>
            </p:outputPanel>
        </h:form>  
    </h:body>  
</html>
